import {get, post, uploadFile} from '../utils/request'
export function getMemberDetail () {
  return get('/api/v2/member/detail')
}

export function getMyCourses (data) {
  return get('/api/v2/member/courses', data)
}

export function setNickName (nickName) {
  return post('/api/v2/member/detail/nickname', {nick_name: nickName })
}

export function setRealName (realName) {
  console.log('setRealName 未实现', realName)
  return new Promise((resolve, reject) => {
    resolve()
  })
  // return post('/member/nickname', {nick_name: realName })
}

export function setAvatar (file) {
  return uploadFile('/api/v2/member/detail/avatar', { name: 'file', file })
}

export function getMyOders (data) {
  return get('/api/v2/member/orders', data)
}
export function getMyOderDetails (id) {
  console.log('getMyOderDetails 未实现 订单详细。id:', id)
  return new Promise((resolve, reject) => {
    resolve()
  })
}

export function setProfile (data) {
  return post('/member/profile', data)
}